#ifndef MYUTILS_H
#define MYUTILS_H

#include <e32cmn.h>
#include <f32file.h>
#include "mk4.h"
#include "mk4str.h"
#include <coemain.h>


class DBUtil : public CCoeStatic
	{
public:
	static DBUtil* Static();
	DBUtil();
	~DBUtil();
	void ConstructL();
	
	//db
	TPtrC8 FieldStr8Value(c4_View* view, char* fieldname, int pos);
	TPtrC8 FieldUtf8Value(c4_View* view, char* fieldname, int pos);	
	int FindByStr(c4_View* view, char* fieldname, char* keyvalue);
	//str
	void ConvertDesToStr(const TPtrC& source, char* dest);
	bool FindBookPrefix(const TPtrC& path);
	TPtrC GetRealPath(const TPtrC& path);
private:
	c4_String iStrTemp;
	};

class MyImgFile
{
public:
	MyImgFile();
	~MyImgFile();
public:
	const TPtrC8 ImgBlock(int pos, int size);
	void ReleaseBlock();
	void Init(const TDesC& FileName);
	void SaveToFile(const TDesC8& data);
	int Length(); //current file size
private:
	bool iAllocated;
    RFile _rfile;
    RFs _fs;	
    HBufC8* iFileData8;
};

#endif
